<include file="Common:header"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/global.css">
<body class="change_name">
	<div class="header">
		修改昵称
		<a href="javascript:history.back();" class="back">
			<img src="__PUBLIC__/img/back.png"><span class="back_cs">返回</span>
		</a>
	</div>
	<div class="form_content">
		<div class="form-input">
			<div class="user_name">
				<label for="username" class="label_font">输入新昵称：</label>
				<input type="text" class="input_e_i" name="username" value="<{$member_info['username']}>" placeholder="请输入新昵称">
			</div>
		</div>
		<div class="max_box">
			<div class="form-input">
				<button class="input_e_s" onclick="change_name(this)">
					提&nbsp;交&nbsp;修&nbsp;改
				</button>
			</div>
		</div>
	</div>
<include file="Common:menu"/>
</body>
</html>
<script type="text/javascript">
	function change_name(obj){
		var username = $('input[name="username"]').val();
		if($(obj).attr('readonly')){
			return false;
		}
		if ($.trim(username) == '')
		{
			layer.open({
   	            content:'昵称不能为空',
            });
			return false;
		}
		$(obj).attr('readonly','readonly');
		$.ajax({
			type: "POST",
			url: "<{:U('Home/User/change_name')}>",
			data: "username="+username+"",
			success: function(msg){
				if(msg.status == '1'){
					layer.open({
   	                    content:msg.msg+' [即将返回个人中心]',
                        btn: ['确认'],
                        yes:function(){
                           window.location.href = "<{:U('Home/User/people_centre')}>";
                        }
                    });
				}else{
				
					layer.open({
   	                    content:msg.msg,
                    });

				}
			$(obj).removeAttr('readonly');
			}
		});
	}
</script>